import type { IColumnsOption } from 'vc';
import { INDEX, COMPANY_NAME, BUSINESS_DATA, REGISTERED_CAPITAL, PROVINCE, CITY, COUNTRY, INDUSTRY_CATEGORY, INFO_SOURCE } from '@/utils/tableColumn';

export function useTable() {
  const columns = ref<IColumnsOption[]>([
    { ...INDEX },
    { ...COMPANY_NAME },
    {
      title: '披露日期',
      field: 'noticeDate',
      width: 110,
      align: 'center',
      sortable: true
    },
    {
      ...INFO_SOURCE('catalogueName'),
      field: 'catalogueName'
    },
    {
      minWidth: 100,
      field: 'evaluationLevelCode',
      title: '认定级别',
      align: 'center',
      sortable: true
    },
    {
      field: 'statisticalYear',
      title: '认定年度',
      sortable: true,
      width: 100,
      align: 'center'
    },
    {
      minWidth: 220,
      field: 'productName',
      title: '产品/工序',
      align: 'center',
      sortable: true,
      showOverflow: 'title'
    },
    {
      minWidth: 150,
      field: 'unitEnergyConsumption',
      title: '单位能耗',
      sortable: true
    },
    {
      minWidth: 220,
      field: 'evaluationAuthority',
      title: '发布单位',
      sortable: true
    },
    { ...PROVINCE },
    { ...CITY },
    { ...COUNTRY },
    { ...INDUSTRY_CATEGORY },
    { ...BUSINESS_DATA },
    { ...REGISTERED_CAPITAL }
  ]);

  return {
    columns
  };
}
